/*
 * GlobalRmiMessenger.java
 *
 * Created on 9 de Fevereiro de 2007, 13:35
 */

package cefetpb.pod.agenda.cliente;

import java.rmi.registry.LocateRegistry;
import java.rmi.RemoteException;
import java.rmi.NotBoundException;
import cefetpb.pod.agenda.remote.RmiMessenger;

/**
 *
 * @author Rosberg
 */
public class GlobalRmiMessenger {
    
    private static RmiMessenger rmiMessenger;
    
    public static void initInstance(String remoteHostName, String serviceName) throws RemoteException, NotBoundException {
        rmiMessenger = (RmiMessenger)LocateRegistry.getRegistry(remoteHostName).lookup(serviceName);
    }
    
    public static RmiMessenger getInstance() {
        return rmiMessenger;
    }
    
    private GlobalRmiMessenger() {
    }
}